#include "HUD.h"	

HUD::HUD()
{
	m_dejavusans = al_load_ttf_font("assets/DejaVuSans.ttf", 15, 0);

	m_answered = 0;
	m_devices = 0;
	m_question_selected = 0;
	m_hud_bitmap = al_load_bitmap("assets/HUD.png");

	m_correct_code[0] = 0;
	m_correct_code[1] = 1;
	m_correct_code[2] = 3;
	m_correct_code[3] = 3;
	m_correct_code[4] = 7;
	m_correct_code[5] = 1;
	m_correct_code[6] = 3;
	m_correct_code[7] = 3;
	m_correct_code[8] = 7;
	m_correct_code[9] = 0;

	game_won = false;
}

HUD::~HUD()
{
	al_destroy_bitmap(m_hud_bitmap);
}

void HUD::SetDevices(int new_value)
{
	m_devices = new_value;
}

int HUD::GetDevices()
{
	return m_devices;
}

void HUD::Render()
{
	al_draw_bitmap(m_hud_bitmap, 0, 560, 0);
	al_draw_textf(m_dejavusans, al_map_rgb(0,0,0), 42, 572, 0, "%d", m_answered);
	al_draw_textf(m_dejavusans, al_map_rgb(0,0,0), 130, 572, 0, "%d", m_devices);
	
	for(int i=0 ; i<m_answered ; i++)
		al_draw_textf(m_dejavusans, al_map_rgb(0,0,0), 394+(i*41), 572, 0, "%d", m_correct_code[i]);

}

void HUD::AnsweredaQuestion()
{
	m_answered++;
	if(m_answered == 10)
		game_won = true;
}

int HUD::GetNumberOfQuestionsAnswered()
{
	return m_answered;
}

bool HUD::GetGameWon()
{
	return game_won;
}

